<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>

<script language="JavaScript">
function validate(form)
{
	var email = document.getElementById("emailWarning");
    var password = document.getElementById("passwordWarning");
    email.style.visibility="hidden";
    password.style.visibility="hidden";
    
    if (form.email.value=="") 
    {
        email.style.visibility="visible";
        form.email.focus();
    }
    else if (form.password.value != form.verifyPassword.value && form.password.value != "") 
    {
        password.style.visibility="visible";
        form.password.focus();
    }

    else 
    {
    	document.getElementById("button").disabled = true;
    	document.getElementById("button").value = "Creating...";
        form.submit();
    }
}
</script>

<body>
<jsp:include page="/includes/nav.jsp" />
<h1>Create a New Account</h1>
<h2>${failed }</h2>
<p>If you failed to login you got redirected here automatically,
sorry about that.</p>
<form action="create" method="post">
<table cellpadding="5" border="0">
	<tr>
		<td></td>
		<td>${failed}</td>
	</tr>
	<tr>
		<td align="right">
		<p>Email Address:
		</td>
		<td><input type="text" name="email"></td>
		<td>
		<div id="emailWarning" style="visibility: hidden;">Please make
		sure your passwords match.</div>
		<td>
	</tr>

	<tr>
		<td align="right">
		<p>Password:
		</td>
		<td><input type="password" name="password"></td>
		<td>
		<div id="passwordWarning" style="visibility: hidden;">If
		registering, both password fields must match.</div>
		<td>
	</tr>
	<tr>
		<td align="right">
		<p>Verify Password:
		</td>
		<td><input type="password" name="verifyPassword"></td>

	</tr>


	<tr>
		<td></td>
		<td><input type="button" value="Submit" id="button"
			onClick="validate(this.form)"></td>
	</tr>
</table>
</form>


</body>
</html>